package com.zros.modules.system.controller;
 
 
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.zros.common.api.vo.Result;
import com.zros.modules.system.entity.DataResource;
import com.zros.modules.system.service.IDataResourceService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
 
/**
 * <p>
    *  前端控制器
    * </p>
 *
 * @author pangyinqiang
 * @since 2019-04-12
 * @version v1.0
 */
@Api(tags = {""})
@RestController
@RequestMapping("/dataresource")
public class DataResourceController {
	@Autowired
    private IDataResourceService  dataResourceService;

    @GetMapping(value = "/tree")
	/*
	 * @RequiresPermissions("resourceTable")
	 * 
	 * @RequiresRoles("SYSADMIN")
	 */
    @ApiOperation(value = "查询权限资源树", notes = "树状展示权限资源信息")
    @ApiImplicitParam(paramType = "query", name = "parentId", value = "父级ID", required = false, dataType = "Long")
    public Result<List<DataResource>> queryResourceTree(Long parentId) {
        List<DataResource> treeList = dataResourceService.queryDataResourceByParentId(parentId);
        return new Result<List<DataResource>>().success().put(treeList);
    }
}
